<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>选择课题</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

	<script type="text/javascript" src="${pageContext.request.contextPath}/js/topicManage.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/getThesisDesc.js"></script>
</head>
<body>
	<div class="container">
		<jsp:include page="_studentHomeHead.jsp" />
	</div>
	<div class="container">
		<div class="col-md-2"></div>
		<div class="col-md-8">
			<!-- <h4>选择课题</h4> -->
			<ul class="list-inline">
					<li>课题管理</li>
					<li>/</li>
					<li>选择课题</li>
				</ul>
			<br>
			<form action="${pageContext.request.contextPath}/student/selectTopic" method="post">
				<input type="hidden" name="id" id="id" value="${sessionScope.student.id }" />
				<div class="col-md-5">
					<span>
						请选择
					</span>
					<input type="text" id="selectPage" class="form-control" >

				</div>
				<input type="hidden" id="topic" name="topic">
				<div class="col-md-6">
					<textarea class="form-control"  readonly="readonly" style="width: 350px;height: 120px"  id="thesisDesc" name="thesisDesc" ondblclick="show();"></textarea>
				</div>
				<div class="col-md-1">
					<div class="form-group">
						<button class="btn btn-primary" type="submit">提交</button>
					</div>
				</div>

			</form>
		</div>
		<div class="col-md-2"></div>
	</div>
</body>
</html>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-2.1.4.min.js"></script>
<link href="${pageContext.request.contextPath}/select/selectpage.css" rel="stylesheet" />
<script src="${pageContext.request.contextPath}/select/selectpage.js"></script>
<script src="${pageContext.request.contextPath}/select/selectpage.min.js"></script>

    <script type="text/javascript">
        $.ajax({
            type : "GET",
            url : "${pageContext.request.contextPath}/student/getJson",//url填写的是请求的路径
            async: false,
            success : function(data) {//请求的返回成功的方法
                var tag_data =data;
                //初始化插件
                $('#selectPage').selectPage({
                    showField : 'name',
                    keyField : 'id',
                    data : tag_data,
                    pageSize : 3,
                    eSelect : function(data){
                        console.log(data)
                        $('#topic').val(data.id);
                        $("#thesisDesc").val(data.des);

                    },
                });
                },
            error : function(XMLHttpRequest, textStatus, errorThrown) {//请求的失败的返回的方法
                alert("删除失败，请稍后再次尝试删除！");
            }
        });

</script>